package activity;

import java.util.ArrayList;

import models.Score;

import flyingpig.com.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import application.Globalstate;

public class HighscoreActivity extends Activity{

	private Score[] highscoreList = {};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.highscore);
		Globalstate gs = (Globalstate) getApplication();
		ArrayList<Score> hsl = gs.getHighscoreList();
		ListView lv = (ListView) findViewById(R.id.highscore_list);
		highscoreList = hsl.toArray(new Score[0]);
		lv.setAdapter(new ArrayAdapter<Score>(this, R.layout.highscorelistview, highscoreList));
		Button backButton = (Button) findViewById(R.id.back_button);
		backButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}


}
